%% Copyright (C) 2012 Estela Moura
%% 
%% This program is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 3 of the License, or
%% (at your option) any later version.
%% 
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%% 
%% You should have received a copy of the GNU General Public License
%% along with Octave; see the file COPYING.  If not, see
%% <http://www.gnu.org/licenses/>.

%% calcula_comprimento (NumCidades, SeqCidades, MatDistancia)

%% Author: Estela Moura <estela@kubuntu-Inspiron>
%% Created: 2012-06-15

function [ComprimentoCaminho]=calcula_comprimento (NumCidades, SeqCidades, MatDistancia)

 %======= Calculando o comprimento do melhor caminho ========%
    ComprimentoCaminho=0;
    for(i=1:NumCidades)
      origem=SeqCidades(i);
      destino=SeqCidades(i+1);
      ComprimentoCaminho=ComprimentoCaminho+MatDistancia(origem, destino);
    end

end
